<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="../resources/orientation-event-helpers.js"></script>
<script>
'use strict';

promise_test(async (t) => {
  const helper = new SensorTestHelper(t, 'deviceorientation');
  await helper.grantSensorsPermissions();
  await helper.initializeSensors();

  const orientationData1 = generateOrientationData(1, 2, 3, false);
  await helper.setData(orientationData1);

  await Promise.all([
    waitForEvent(getExpectedOrientationEvent(orientationData1)),
    waitForEvent(getExpectedOrientationEvent(orientationData1))
  ]);

  const orientationData2 = generateOrientationData(11, 12, 13, false);
  await helper.setData(orientationData2);
  await waitForEvent(getExpectedOrientationEvent(orientationData2));
}, 'Tests using multiple event handlers for the Device Orientation API.');
</script>
